<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>电影详情</title>
    <link href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="container">
    <h1 class="text-center">电影详情页面</h1>
    <div class="row">
        <div class="col-2"><h6>姓名：  马泽强</h6></div>
        <div class="col-10"><h6>学号：  1604220525</h6></div>
    </div>
    <div class="dropdown-divider"></div>
    <div class="row">
        <div class="col-2">
            <div class="list-group">
                <a class="list-group-item list-group-item-action active" th:href="@{/movie/index}">电影管理</a>
                <a class="list-group-item list-group-item-action" th:href="@{/actor/index}" >演员管理</a>
            </div>
        </div>
        <div class="col-10">
            <div class="row">
                <div class="col">
                    <label>电影名称：</label>
                    <span th:text="${info.name}">黄飞鸿</span>
                </div>
                <div class="col">
                    <label>发行日期：</label>
                    <span th:text="${#dates.format(info.createDate, 'yyyy-MM-dd')}">黄飞鸿</span>
                </div>
            </div>
            <h3>角色列表</h3>
            <a class="btn btn-primary" th:href="@{/role/add/{movieId}(movieId = ${info.id})}">新增</a>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">角色</th>
                    <th scope="col">演员</th>
                    <th scope="col">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="role,roleStat : ${info.roles}">

                    <td th:text="${roleStat.index + 1}">#</td>
                    <td th:text="${role.name}"></td>
                    <td th:text="${role.actor.name}"></td>
                    <td>
                        <a th:href="@{/role/{movieId}/edit/{roleId}(movieId = ${info.id},roleId = ${role.getId()})}">编辑</a>
                        <a th:href="@{/role/{movieId}/delete/{roleId}(roleId = ${role.id})}">删除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>